/**
 * 
 */
package br.gfca.simplenet.util;

/**
 * @author Gustavo
 *
 */
public class Printer {
	
	private static Printer p;
	private boolean enabled;
	
	private Printer( boolean enabled ) {
		this.enabled = enabled;
	}
	
	public static void createInstance( boolean enabled ) {
		if ( p == null) {
			p = new Printer( enabled );
		}
	}
	
	public static Printer getInstance() {
		if ( p == null ) {
			p = new Printer( false );
		}
		
		return p;
	}
	
	public void printError( String message) {
		if ( this.enabled ) {
			System.err.println( ">>> " + message );
		}
	}

	public void printStack(Exception e) {
		if ( this.enabled ) {
			e.printStackTrace( System.err );
		}
	}
}